home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Tools / Text-Viewer / MSWordView / mswordview_src / init_chp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-06  |  6.8 KB  |  196 lines

  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "config.h"
  5. #include "mswordview.h"
  6.  
  7. extern int NORMAL;
  8. extern int lastrowlen;
  9. extern S16 lastcellwidth[65];
  10. extern int nostyles;
  11. extern FILE *erroroutput;
  12.  
  13. void copy_tap(tap *rettap,tap *intap)
  14.     {
  15.     int i;
  16.     rettap->tlp.itl=intap->tlp.itl;
  17.     rettap->tlp.fShading=intap->tlp.fShading;
  18.     rettap->tlp.fColor=intap->tlp.fColor;
  19.     rettap->tlp.fHdrRows=intap->tlp.fHdrRows;
  20.     rettap->tlp.fLastRow=intap->tlp.fLastRow;
  21.     rettap->tlp.fHdrCols=intap->tlp.fHdrCols;
  22.     rettap->tlp.fLastCol=intap->tlp.fLastCol;
  23.     rettap->tablewidth = intap->tablewidth;
  24.     rettap->cell_no = intap->cell_no;
  25.     rettap->rowheight=intap->rowheight;
  26.     rettap->shade_no=intap->shade_no;
  27.  
  28.     for (i=0;i<65;i++)
  29.         {
  30.         rettap->cell_backs[i] = intap->cell_backs[i];
  31.         rettap->cell_fronts[i] = intap->cell_fronts[i];
  32.         rettap->cell_pattern[i] = intap->cell_pattern[i];
  33.         rettap->cellwidth[i] = intap->cellwidth[i];
  34.         }
  35.     }
  36.  
  37.  
  38. void init_pap(pap * retpap)
  39.     {
  40.     int i;
  41.     retpap->fInTable = 0;
  42.     retpap->fTtp= 0;
  43.     retpap->justify = 0;
  44.     retpap->ilvl = -1;
  45.     retpap->ilfo = -1; /*index into hpllfo*/
  46.     retpap->list_data=NULL;
  47.     retpap->tableflag=0;
  48.     retpap->leftmargin=0;
  49.     retpap->rightmargin=0;
  50.     retpap->firstline=0;
  51.     retpap->istd=0;
  52.     retpap->ourtap.tlp.itl=0;
  53.     retpap->ourtap.tlp.fShading=0;
  54.     retpap->ourtap.tlp.fColor=0;
  55.     retpap->ourtap.tlp.fHdrRows=0;
  56.     retpap->ourtap.tlp.fLastRow=0;
  57.     retpap->ourtap.tlp.fHdrCols=0;
  58.     retpap->ourtap.tlp.fLastCol=0;
  59.     retpap->ourtap.tablewidth = 0;
  60.     retpap->ourtap.cell_no = lastrowlen;
  61.     retpap->ourtap.rowheight=0;
  62.     retpap->ourtap.shade_no=0;
  63.     for (i=0;i<65;i++)
  64.         {
  65.         retpap->ourtap.cell_backs[i] = 0;
  66.         retpap->ourtap.cell_fronts[i] = 0;
  67.         retpap->ourtap.cell_pattern[i] = 0;
  68.         }
  69.     if (lastrowlen > 63)    
  70.     lastrowlen=63;
  71.     for (i=0;i<lastrowlen+1;i++)
  72.         {
  73.         retpap->ourtap.cellwidth[i] = lastcellwidth[i];
  74.         retpap->ourtap.tablewidth+=lastcellwidth[i];
  75.         }
  76.  
  77.     retpap->brcBottom=0;
  78.     retpap->brcLeft=0;
  79.     retpap->brcRight=0;
  80.     retpap->brcBetween=0;
  81.     retpap->dxaWidth=0;
  82.     retpap->dyaBefore=0;
  83.     retpap->dyaAfter=0;
  84.     }
  85.  
  86.  
  87. void init_pap_from_istd(U16 istd,style *sheet,pap *retpap)
  88.     {
  89.     retpap->fInTable  = sheet[retpap->istd].thepap.fInTable;
  90.     retpap->fTtp = sheet[retpap->istd].thepap.fTtp;
  91.     retpap->ilvl = sheet[retpap->istd].thepap.ilvl;
  92.     retpap->ilfo = sheet[retpap->istd].thepap.ilfo;
  93.     retpap->justify= sheet[retpap->istd].thepap.justify;
  94.     retpap->list_data = sheet[retpap->istd].thepap.list_data;
  95.     retpap->anld = sheet[retpap->istd].thepap.anld;
  96.     retpap->leftmargin = sheet[retpap->istd].thepap.leftmargin;
  97.     retpap->rightmargin = sheet[retpap->istd].thepap.rightmargin;
  98.     retpap->firstline = sheet[retpap->istd].thepap.firstline;
  99.     retpap->tableflag= sheet[retpap->istd].thepap.tableflag;
  100.     retpap->brcBottom= sheet[retpap->istd].thepap.brcBottom;
  101.     retpap->brcLeft= sheet[retpap->istd].thepap.brcLeft;
  102.     retpap->brcRight= sheet[retpap->istd].thepap.brcRight;
  103.     retpap->brcBetween= sheet[retpap->istd].thepap.brcBetween;
  104.     retpap->dxaWidth=sheet[retpap->istd].thepap.dxaWidth;
  105.     retpap->dyaAfter=sheet[retpap->istd].thepap.dyaAfter;
  106.     retpap->dyaBefore=sheet[retpap->istd].thepap.dyaBefore;
  107.     copy_tap(&(retpap->ourtap),&(sheet[retpap->istd].thepap.ourtap));
  108.     }
  109.  
  110. void init_chp(chp * achp)
  111.     {
  112.     achp->istd=10;
  113.     achp->fBold=0;
  114.     achp->fItalic=0;
  115.     achp->fCaps=0;
  116.     achp->fSmallCaps=0;
  117.     achp->animation=0;
  118.     achp->ascii_font=0;
  119.     achp->eastfont=0;
  120.     achp->noneastfont=0;
  121.     achp->fontsize=NORMAL;
  122.     achp->supersubscript=0;
  123.     achp->fontcode=0;
  124.     achp->fontspec=0;
  125.     achp->fSpec=0;
  126.     achp->fObj=0;
  127.     achp->fOle2=0;
  128.     achp->color[0]='\0';
  129.     achp->underline=0;
  130.     achp->idctHint=0;
  131.     achp->fcPic=-1;
  132.     achp->fData=0;
  133.     achp->fStrike=0;
  134.     achp->fDStrike=0;
  135.     }
  136.  
  137.  
  138. void init_chp_from_istd(U16 istd,style *sheet,chp *retchp)
  139.     {
  140.     if (istd >= nostyles)
  141.         {
  142.         error(erroroutput,"istd greater than no of styles !!\n");
  143.         return;
  144.         }
  145.     retchp->istd = istd;
  146.     retchp->fBold=sheet[istd].thechp.fBold;
  147.     retchp->fItalic=sheet[istd].thechp.fItalic;
  148.     retchp->fCaps =sheet[istd].thechp.fCaps;
  149.     retchp->fSmallCaps =sheet[istd].thechp.fSmallCaps;
  150.     retchp->animation =sheet[istd].thechp.animation;
  151.     retchp->ascii_font=sheet[istd].thechp.ascii_font;
  152.     retchp->eastfont=sheet[istd].thechp.eastfont;
  153.     retchp->noneastfont=sheet[istd].thechp.noneastfont;
  154.     retchp->fontsize=sheet[istd].thechp.fontsize;
  155.     retchp->supersubscript=sheet[istd].thechp.supersubscript;
  156.     retchp->fontcode=sheet[istd].thechp.fontcode;
  157.     retchp->fontspec=sheet[istd].thechp.fontspec;
  158.     strcpy(retchp->color,sheet[istd].thechp.color);
  159.     retchp->underline=sheet[istd].thechp.underline; 
  160.     retchp->fSpec=sheet[istd].thechp.fSpec;
  161.     retchp->fObj=sheet[istd].thechp.fObj;
  162.     retchp->fOle2=sheet[istd].thechp.fOle2;
  163.     retchp->idctHint=sheet[istd].thechp.idctHint;
  164.     retchp->fcPic =sheet[istd].thechp.fcPic;
  165.     retchp->fData=sheet[istd].thechp.fData;
  166.     retchp->fStrike=sheet[istd].thechp.fStrike;
  167.     retchp->fDStrike=sheet[istd].thechp.fDStrike;
  168.     }
  169.  
  170. void merge_chps(chp *blank,chp *modified,chp *result)
  171.     {
  172.     if (blank->fBold != modified->fBold) result->fBold = modified->fBold;
  173.     if (blank->fItalic != modified->fItalic) result->fItalic= modified->fItalic;
  174.     if (blank->fCaps != modified->fCaps) result->fCaps= modified->fCaps;
  175.     if (blank->fSmallCaps != modified->fSmallCaps) result->fSmallCaps= modified->fSmallCaps;
  176.     if (blank->animation!= modified->animation) result->animation= modified->animation;
  177.     if (blank->ascii_font!= modified->ascii_font) result->ascii_font= modified->ascii_font;
  178.     if (blank->eastfont!= modified->eastfont) result->eastfont= modified->eastfont;
  179.     if (blank->noneastfont!= modified->noneastfont) result->noneastfont= modified->noneastfont;
  180.     if (blank->fontsize!= modified->fontsize) result->fontsize= modified->fontsize;
  181.     if (blank->supersubscript!= modified->supersubscript) result->supersubscript= modified->supersubscript;
  182.     if (blank->fontcode!= modified->fontcode) result->fontcode= modified->fontcode;
  183.     if (blank->fontspec!= modified->fontspec) result->fontspec= modified->fontspec;
  184.     if (blank->underline!= modified->underline) result->underline= modified->underline;
  185.     if (blank->fSpec!= modified->fSpec) result->fSpec= modified->fSpec;
  186.     if (blank->fObj!= modified->fObj) result->fObj= modified->fObj;
  187.     if (blank->fOle2!= modified->fOle2) result->fOle2= modified->fOle2;
  188.     if (blank->idctHint!= modified->idctHint) result->idctHint= modified->idctHint;
  189.     if (blank->fcPic!= modified->fcPic) result->fcPic= modified->fcPic;
  190.     if (blank->fData!= modified->fData) result->fData= modified->fData;
  191.     if (strcmp(blank->color,modified->color)) strcpy(result->color,modified->color);
  192.     if (blank->fStrike!= modified->fStrike) result->fStrike= modified->fStrike;
  193.     if (blank->fDStrike!= modified->fDStrike) result->fDStrike= modified->fDStrike;
  194.     }
  195.  
  196.